import { request } from "@/utils/service"
import type * as types from "./types/index"
import { usernameLoginRequestData } from "./types/index"

export function usernameLoginApi(data: usernameLoginRequestData) {
  return request<types.loginResponseData>({
    url: "login",
    method: "post",
    data
  })
}
export function emailLoginApi(email: string) {
  return request<types.loginResponseData>({
    url: "emailLogin?email=" + email,
    method: "post"
  })
}

export function phoneLoginApi(phoneNum: string) {
  return request<types.loginResponseData>({
    url: "SendMessageToPhone?phone=" + phoneNum,
    method: "get"
  })
}

export function registerApi(data: types.registerRequestData) {
  return request<types.registerResponseData>({
    url: "register",
    method: "post",
    data
  })
}
